package com.gilight.base.uiapp.user;


import com.gilight.base.base.exception.ServiceException;
import com.gilight.base.dto.uni.UserDTO;

/**用户服务
 * Created by rize on 2019/6/30.
 */
public interface AppUserService {

    /**
     * 发送验证码到用户手机
     * @param phone
     * @return
     * @throws ServiceException
     */
    public String sendVerifyCode(
            String phone) throws ServiceException;

    /**
     * 用户注册
     * @param phone 用户手机号
     * @param password
     * @param verifyCode  注册验证码
     * @param ip
     * @return
     * @throws ServiceException
     */
    public String register(
            String phone,
            String password,
            String verifyCode,
            String ip) throws ServiceException;

    /**
     * 用户绑定手机号
     * @param phone
     * @param password
     * @param verifyCode
     * @param userId
     * @return
     * @throws ServiceException
     */
    public String bindPhone(
            String phone,
            String password,
            String verifyCode,
            Long userId) throws ServiceException;

    /**
     * 用户重置密码
     * @param phone
     * @param password
     * @param verifyCode
     * @return
     * @throws ServiceException
     */
    public String resetPassword(
             String phone,
             String password,
             String verifyCode) throws ServiceException;

    /**
     * 用户登录
     * @param phone  用户手机号
     * @param password
     * @param loginType 登录方式
     * @param raw  第三方平台返回的数据
     * @param ip
     * @return
     * @throws ServiceException
     */
    public UserDTO login(
            String phone,
            String password,
            Integer loginType,
            String raw,
            String ip) throws ServiceException;

    /**
     * 用户注销
     * @param accessToken 用户访问
     * @param userId
     * @return
     * @throws ServiceException
     */
    public String logout(
            String accessToken,
            Long userId) throws ServiceException;

    /**
     * 第三方登录
     * @param loginType
     * @param ip
     * @param raw
     * @return
     * @throws ServiceException
     */
    public UserDTO thirdPartLogin(
            Integer loginType,
            String ip,
            String raw) throws ServiceException;

    /**
     * 同步用户信息
     * @param nickname
     * @param avatarUrl
     * @param gender
     * @param birthday    性别0未知1男2女
     * @param accessToken
     * @param userId
     * @return
     * @throws ServiceException
     */
    public String syncUserInfo(
            String nickname,
            String avatarUrl,
            Integer gender,
            Long birthday,
            String accessToken,
            Long userId) throws ServiceException;

    /**
     * H5 页面签名
     * 当H5页面需要调用微信的API时，微信为防止DNS劫持等情况，他是需要对每个页面进行签名的
     *
     * @param url
     * @return
     * @throws ServiceException
     */
    public Object getH5Sign(
            String url) throws ServiceException;

    /**
     * 检测登录
     * @param accessToken
     * @return
     * @throws ServiceException
     */
    public Boolean checkLogin(
            String accessToken) throws ServiceException;

}
